<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>旅动足球</title>
	<meta name="viewport" content="initial-scale=1, maximum-scale=1">
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">

	<link rel="stylesheet" href="https://g.alicdn.com/msui/sm/0.6.2/css/sm.min.css">
	<link rel="stylesheet" type="text/css" href="./css/reset.css?v=1.1.56">
	<link rel="stylesheet" type="text/css" href="./css/common.css?v=1.1.56">
	<link rel="stylesheet" type="text/css" href="./css/strategy.css?v=1.1.56">
	<script type='text/javascript' src='https://g.alicdn.com/sj/lib/zepto/zepto.min.js' charset='utf-8'></script>
</head>
<body>
	<div class="page">
		<header class="bar bar-nav" href="./index.html">
			<a class="icon iconfont pull-left" href="https://worldcup.dmpb.com.cn/index">&#xe60d;</a>
			<h1 class="title">攻略集锦</h1>
		</header>
		<div class="content">
				<!-- <li class="strategy-item">
					<a href="./strategy1.html">
						<img src="./images/stragety/2.jpeg">
						<div class="tit">旅动足球世界杯系列攻略之—</div>
						<div class="text">2018年世界杯即将在俄罗斯开幕啦，我们将进行一系列作家、图书及影视介绍，希望唤起大家对俄罗斯文化的热情，让球迷朋友们不仅享受足球盛宴，亦愿美好文字与影像伴随大家抵达更辽阔的精神大陆。</div>
						<div class="time">2017.05.02 21:57</div>
					</a>
				</li> -->
		</div>
	</div>
</body>
<script type='text/javascript' src='https://g.alicdn.com/msui/sm/0.6.2/js/sm.min.js' charset='utf-8'></script>
<script type="text/javascript" src="./js/common.js?v=1.1.57"></script>
<script type="text/javascript">
	$(function () {
		$(document).on('click', '.j-look', onLook);

		// $.ajax({
		// 	url: HOST + '/api/article/list',
		// 	success: function (res) {
		// 		var html = res.content.reduce(function (memo, item) {
		// 			return memo + getHtml(item);
		// 		}, '');
		// 		$('.content').html(html);
		// 	}
		// });

		$.ajax({
			url: HOST + '/api/article/group',
			success: function (res) {
				var html = res.content.reduce(function (memo, item) {
					return memo + getGoup(item);
				}, '');
				$('.content').html(html);
			}
		});
	});

	function getHtml(data) {
		return '<div class="strategy-item j-look" data-id="'+data.id+'">\
					<img src="'+(data.surveyImage?data.surveyImage:'./images/stragety/2.jpeg')+'">\
					<div class="tit">'+data.name+'</div>\
					<div class="text">'+data.survey+'</div>\
					<div class="time">点击数：'+data.hits+'</div>\
				</div>';
	}
	function getGoup(data) {
		return '<div class="group-title">'+data.categoryName+'</div>'+data.articles.reduce(function(memo, item) {
			return memo + getHtml(item);
		}, '');
	}

	function onLook (e) {
		window.location = './strategy1.html?id='+$(e.currentTarget).data('id')
	}
</script>
</html>
